-- FETCH_MACHINE_FACTORY_MONSTER

-- 抽取机械工厂刷出的怪物
-- @param classId dungeon.csv中的class
return function(classId)
    local allInfo = ME.user.dbase:query("monster_building_info", {});
    local info = allInfo[classId] or {};
    local monsterNum = (info["monster_num"] or 0) + 1;

    local layer = DungeonM.currentLayer();
    local monsters;

    -- 机械巡逻者的element_id/根据层数不同怪物不同
    if layer > 10 then
        monsters = {[20001] = 20002, [20002] = 20104, [20003] = 20206};
    elseif layer > 5 then
        monsters = {[20001] = 20002, [20002] = 20104, [20003] = 20204};
    else
        monsters = {[20001] = 20002, [20002] = 20102, [20003] = 20202};
    end

    -- 困难模式的X-04机械修理师
    local x04element;
    if layer > 10 then
        x04element = 20228;
    elseif layer > 5 then
        x04element = 20227;
    else
        x04element = 20207;
    end

    -- 当前地牢
    local dungeonId = DungeonM.getDungeonId();
    -- local round = CombatM.getRound();
    if dungeonId == 20003 and monsterNum % 3 == 0 then
        -- 困难模式，每3个召唤
        return x04element;
    end

    -- 返回对应迷宫的element_id
    return monsters[dungeonId];
end